package com.demo01;

public class TestThread2 implements Runnable {
    private int tickNums = 10;
    @Override
    public void run() {
        while (true) {
            if (tickNums <= 0) {
                break;
            }
            System.out.println(Thread.currentThread().getName()+"----->拿到了第" + tickNums--+"票");
        }
    }
    public static void main(String[] args) {
        TestThread2 ticket = new TestThread2();
        new Thread(ticket,"小明").start();
        new Thread(ticket,"小红").start();
        new Thread(ticket,"黄牛党").start();
    }

}
